/*
	Author      : Sidek Sirun
	Course      : UCI Java Programming I (X460.10)
	Assignment 5: Teacher subclass

	Create a subclass of your Person class called Teacher.
	In addition to the existing Person attributes, a Teacher
	has a room # and one or more courses.
*/

public class Teacher extends Person {
	// Instance Variables
	private int roomNumber;
	//private ArrayList<String> course = new ArrayList<String>();
	private String[] course;

	// Constructors
	public Teacher(String firstName, String lastName, int age, String gender, String ssn, int roomNumber, String[] course) {
		super(firstName, lastName, age, gender, ssn);
		this.roomNumber = roomNumber;
		this.course     = course;
	}

	// Methods
	public void setRoomNumber(int roomNumber) {
		this.roomNumber = roomNumber;
	}

	public int getRoomNumber() {
		return roomNumber;
	}

	public void setCourse(String[] course) {
		this.course = course;
	}

	public String getCourse() {
		String   courseList = "";
		String[] c          = course;
		int      count      = 0;
		for (int i = 0; i < c.length; i++) {
			count++;
			if (count == 1) {
				courseList = c[i];
			} else {
				courseList = courseList + ", " + c[i];
			}
		}
		return courseList;
	}

	public String toString() {
		String teacherInfo = "Full Name: " + super.getFullName() + ", Age: " + super.getAge() 
		                     + ", Gender: " + super.getGender() + ", SSN: " + super.getSSN()
		                     + ", Room#: " + getRoomNumber() + ", Course(s): " + getCourse();
		return teacherInfo;
	}

}